package com.hsav.kcxb.adapter;

import android.content.Context;
import android.provider.ContactsContract;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.hsav.kcxb.R;
import com.hsav.kcxb.bean.ContributeBean;
import com.hsav.kcxb.utils.ImgLoadUtil;
import com.zhy.autolayout.utils.AutoUtils;

import java.util.ArrayList;

/**
 * Created by zhao on 2017/2/5.
 */

public class ContributeAdapter extends BaseAdapter {

    private final Context mContext;
    private final LayoutInflater mLayoutInflater;

    public ContributeAdapter(Context context) {
        this.mContext = context;
        this.mLayoutInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return 10;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (convertView == null) {
            convertView = mLayoutInflater.inflate(R.layout.item_contribute_view, parent, false);
            viewHolder = new ViewHolder();
            viewHolder.headImg = (ImageView) convertView.findViewById(R.id.img_contribute);
            viewHolder.nameTx = (TextView) convertView.findViewById(R.id.tx_contri_name);
            viewHolder.amountTx = (TextView) convertView.findViewById(R.id.tx_contri_amount);
            convertView.setTag(viewHolder);
            AutoUtils.autoSize(convertView);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
//        ContributeBean contributeBean = mContributeList.get(position);
//        viewHolder.nameTx.setText(contributeBean.getName());
//        viewHolder.amountTx.setText(String.valueOf(contributeBean.getAmount()));
//        ImgLoadUtil.setImage(mContext,viewHolder.headImg,contributeBean.getPicture(),R.drawable.head);
        return convertView;
    }

    private class ViewHolder {
        ImageView headImg;
        TextView nameTx;
        TextView amountTx;
    }
}
